<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<iframe src="iframe1.html" style="height:380px;width:520px;"></iframe>

	<p>点击以下按钮获取 iframe 中 h1 节点，并显示在本页中。</p>

	<p><strong>注意:</strong> Internet explorer 8 及更早 IE 版本支持该方法。</p>

	<button onclick="myFunction()">点我</button>	
</body>

<script type="text/javascript">
	
	function myFunction() {

	    var frame = document.getElementsByTagName("iframe")[0]

	    var h = frame.contentWindow.document.getElementsByTagName("h1")[0];

	    console.log(h)

	    var x = document.adoptNode(h);

	    document.body.appendChild(x);
	}

</script>
</html>